package com.gitee.l0km.beanfilter.interceptor.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 安装请求拦截器
 * @author guyadong
 *
 */
@Configuration
public class FilterInterceptorConfig implements WebMvcConfigurer {
	@Autowired
	private InstallFilterInterceptor interceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(interceptor)
				.addPathPatterns("/**")  /** 添加拦截路径 */
				.excludePathPatterns("/error","/swagger-resources/**","/swagger/**", "/swagger2/**");/** 排除的拦截路径（此路径不拦截 */
	}

}
